package com.soft.knowledge.config;

import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

//将全局配置文件从knowledge包下移到config包下，要设置配置控制范围
//扫描多个包 @ComponentScan({"com.soft", "com.test"})
@ComponentScan("com.soft")
@SpringBootApplication
@MapperScan("com.soft.knowledge.mapper")
//启动定时任务
@EnableScheduling
//启动异步化线程
@EnableAsync
public class KnowledgeBaseApplication {

    private static final Logger LOG =  LoggerFactory.getLogger(KnowledgeBaseApplication.class);

    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(KnowledgeBaseApplication.class);
        Environment env = app.run(args).getEnvironment();
        LOG.info("启动成功！！");
        LOG.info("地址: \thttp://127.0.0.1:{}", env.getProperty("server.port"));
    }

}
